package cn.cqone.crm.query;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;

public class BaseQuery {
    //当前页
    private Integer currentPage = 1;
    //每页条数
    private Integer pageSize = 10;
    //关键字
    private String keyword;

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getKeyword() {
        return StringUtils.isEmpty(keyword)? null : keyword.trim();
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    //返回开始位置
    public Integer getBegin(){
        return (this.currentPage-1)*this.pageSize;
    }
}
